//
//  LMWarningLabel.m
//  舍品
//
//  Created by 楼 眉 on 16/3/29.
//  Copyright © 2016年 楼 眉. All rights reserved.
//

#import "LMWarningLabel.h"

@implementation LMWarningLabel

+ (void)LM_createWarningLabelWithTitle:(NSString *)title
{
    UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow;
    LMWarningLabel *label = [[LMWarningLabel alloc]init];
    if (title) {
        label.text = title;
    }else
    {
    label.text = @"请检查网络连接";
    }
    label.backgroundColor = [UIColor blackColor];
    label.textColor = [UIColor whiteColor];
    label.textAlignment = NSTextAlignmentCenter;
    label.frame = CGRectMake(0, 0, SCREEN_WIDTH / 2, 44*kUnit);
    label.center = CGPointMake(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2);

    [keyWindow addSubview:label];
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [label removeFromSuperview];
    });
}
@end
